var app = getApp()
var WxParse = require('../../wxParse/wxParse.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: [
      'http://t.image.air-cooking.com/product/list/20170808/59895e37d629a.jpg',
      'http://t.image.air-cooking.com/product/list/20170808/59895e37d629a.jpg',
      'http://t.image.air-cooking.com/product/list/20170808/59895e37d629a.jpg'
    ],
    indicatorDots: true,
    circular: true,
    autoplay: true,
    interval: 5000,
    duration: 1000
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let cbcode = "C32909584";
    let that = this;

    wx.request({
      url: app.URL + 'Menu/menu', //仅为示例，并非真实的接口地址

      data: {
        CbCode: cbcode

      },
      header: {
        'content-type': 'application/x-www-form-urlencoded' // 默认值
      },
      dataType: "json",
      method: 'POST',
      success: function (res) {
        //console.log(res.data);
        that.setData({
          menudetail: res.data,
          dianzannum: res.data.praisenum
        })
        let article = res.data.collocationdetail;
        WxParse.wxParse('article', 'html', article, that, 0);
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  },
  addads:function(){
    wx.chooseAddress({
      success: function (res) {
        console.log(res.userName)
        console.log(res.postalCode)
        console.log(res.provinceName)
        console.log(res.cityName)
        console.log(res.countyName)
        console.log(res.detailInfo)
        console.log(res.nationalCode)
        console.log(res.telNumber)
      }
    })
  }

})